<style>
    body {
        background-color: #ffffff;
    }

    .layui-iconpicker-body.layui-iconpicker-body-page .hide {
        display: none;
    }
</style>

<div class="layui-form layuimini-form">

    <input type="hidden" value="{$model->id}" name="id">


    <div class="layui-form-item">
        <label class="layui-form-label required">任务名称</label>
        <div class="layui-input-block">
            <input type="text" autocomplete="off" name="title" class="layui-input" lay-verify="required"
                   lay-reqtext="请输入任务名称"
                   placeholder="请输入任务名称" value="{$model->title}">
            <tip>填写任务名称</tip>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label required">任务类型</label>
        <div class="layui-input-block">
            <select name="type" lay-verify="required">
                <option value="">请选择任务类型</option>
                {foreach [["title"=>"Shell脚本","type"=>'shell'],["title"=>"访问Url","type"=>'url']] as $vo}
                <option {if $model.type==$vo.type} selected {/if} value="{$vo.type}">{$vo.title|raw}</option>
                {/foreach}
            </select>
            <tip>请选择任务类型</tip>
        </div>
    </div>


    <div class="layui-form-item">
        <label class="layui-form-label required">任务内容</label>
        <div class="layui-input-block">
            <textarea name="content" class="layui-textarea" placeholder="请输入任务内容">{$model->content}</textarea>
            <tip>选择访问URL类型时格式如：http://xxxx/xxxx/xxxx  选择Shell类型时，需要输入完整的shell命令</tip>
        </div>
    </div>


    <div class="layui-form-item">
        <label class="layui-form-label required">Cron表达式</label>
        <div class="layui-input-block">
            <input type="text" autocomplete="off" name="schedule" class="layui-input"
                   placeholder="请输入Cron表达式" lay-verify="required" value="{$model->schedule}">
            <tip>填写Cron表达式</tip>
        </div>
    </div>


    <div class="layui-form-item">
        <label class="layui-form-label required">最大执行次数</label>
        <div class="layui-input-block">
            <input type="text" autocomplete="off" name="maximums" class="layui-input"
                   placeholder="请输入最大执行次数" lay-verify="required|number"  value="{$model->maximums}">
            <tip>0代表不限制次数</tip>
        </div>
    </div>


    <div class="layui-form-item">
        <label class="layui-form-label required">开始时间</label>
        <div class="layui-input-block">
            <input type="text" name="begin_time" id="begin_time" value="{:time_format($model->begin_time)}" lay-verify="required" autocomplete="off" class="layui-input">
            <tip>请选择开始时间</tip>
        </div>
    </div>



    <div class="layui-form-item">
        <label class="layui-form-label required">结束时间</label>
        <div class="layui-input-block">
            <input type="text" name="end_time" id="end_time" value="{:time_format($model->end_time)}" lay-verify="required" autocomplete="off" class="layui-input">
            <tip>请选择结束时间</tip>
        </div>
    </div>


    <div class="layui-form-item">
        <label class="layui-form-label required">执行状态</label>
        <div class="layui-input-block">
            <select name="status" lay-verify="required">
                <option value="">请选择执行状态</option>
                {foreach [["title"=>"禁用","type"=>'0'],["title"=>"正常","type"=>'1'],["title"=>"完成","type"=>'2'],["title"=>"过期","type"=>'3']] as $vo}
                <option {if $model->status==$vo.type} selected {/if} value="{$vo.type}">{$vo.title|raw}</option>
                {/foreach}
            </select>
            <tip>请选择执行状态</tip>
        </div>
    </div>



    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认保存</button>
        </div>
    </div>
</div>
<script>
    layui.use(['form','laydate'], function () {
        var form = layui.form,
            layer = layui.layer,
            $ = layui.$,
            laydate = layui.laydate;
        laydate.render({
            elem: '#begin_time',
            type:"datetime"
        });
        laydate.render({
            elem: '#end_time',
            type:"datetime"
        });
        form.on('submit(saveBtn)', function (data) {
            var post_data = data.field;
            postData("{:url('cron/edit')}", post_data, '修改成功');
            return false;
        });
    });
</script>